{extend name="common/base" /}

{block name="style"}

{/block}
{block name="body"}
<div class="xgnc-mains">
    <input type="text" class="xgnc-input js-nick-name"  placeholder="请填写新昵称，12字以内">
    <div class="xgnc-button">保存</div>
</div>
{/block}
{block name="script"}
<script>
    $('.xgnc-button').on('click', function () {
        var nick = $('.js-nick-name').val();
        if (nick == '') {
            $.toast('请填写昵称', "cancel");
            return;
        }
        $.post("{:url('setNickname')}", {nick_name:nick}, function (res) {
            if (res.code == '1') {
                location.href = "{:url('info')}";
            } else {
                $.toast(res.msg, "cancel");
            }
        }, 'json');
    });
</script>
{/block}